﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PeiXunYingJi.aspx.cs" Inherits="Catering.Catering_Page.richang.PeiXunYingJi" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>培训应急</title>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../Scripts/zhezhao.js" type="text/javascript"></script>
    <link href="../../Style/center.css" rel="stylesheet" type="text/css" />
    <link href="../../Style/sysData.css" rel="stylesheet" type="text/css" />
    <link href="../../Style/zhezhao.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txt_pxqk_riqi").focus(function () { WdatePicker({ dateFmt: 'yyyy-MM-dd' }) });
            $("input[name='rbm']").change(function () {
                var _thisval = $(this).val();
                if (_thisval == "是") {
                    $("#table_yjqk").show("normal");
                    $("#table_pxqk").show("normal");
                } else if (_thisval == "否") {
                    $("#table_pxqk").hide("normal");
                    $("#table_yjqk").hide("normal");
                }
            });
        });

        //添加数据
        function btn_yjqk_Add() {

            var txt_yjqk_mingchen = $("#txt_yjqk_mingchen").val();
            var txt_yjqk_renshu = $("#txt_yjqk_renshu").val();
            var ddl_yjqk_leibie = $("#ddl_yjqk_leibie").val();
            $.ajax({
                type: "Post",
                url: "PeiXunYingJi.aspx/YingJiQingKuang_Add",
                data: "{'txt_yjqk_mingchen':'" + txt_yjqk_mingchen + "','txt_yjqk_renshu':'" + txt_yjqk_renshu + "','ddl_yjqk_leibie':'" + ddl_yjqk_leibie + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "ok") {
                        alert("保存成功！");
                        window.location.href = 'PeiXunYingJi.aspx';
                    }
                }
            });
        }
        //获取数据
        function btn_yjqk_Get(cid) {
            $("#HidID").val(cid);

            $.ajax({
                type: "Post",
                url: "PeiXunYingJi.aspx/YingJiQingKuang_Get",
                data: "{'_id':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#ddl_yjqk_leibie").val(data.d[0] == null ? "" : data.d[0]);
                    $("#txt_yjqk_mingchen").val(data.d[1] == null ? "" : data.d[1]);
                    $("#txt_yjqk_renshu").val(data.d[2] == null ? "" : data.d[2]);

                    $("#btn_yjqk_Edit").show();
                    $("#btn_yjqk_Add").hide();
                    divshow("yjqk_div", "bg");
                }
            });
        }
        //编辑数据
        function btn_yjqk_Edit() {
            var txt_yjqk_mingchen = $("#txt_yjqk_mingchen").val();
            var txt_yjqk_renshu = $("#txt_yjqk_renshu").val();
            var ddl_yjqk_leibie = $("#ddl_yjqk_leibie").val();
            var cid = $("#HidID").val();

            $.ajax({
                type: "Post",
                url: "PeiXunYingJi.aspx/YingJiQingKuang_Edit",
                data: "{'_id':'" + cid + "','txt_yjqk_mingchen':'" + txt_yjqk_mingchen + "','txt_yjqk_renshu':'" + txt_yjqk_renshu + "','ddl_yjqk_leibie':'" + ddl_yjqk_leibie + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = 'PeiXunYingJi.aspx';
                    }
                }
            });
        }

        //添加数据
        function btn_pxqk_Add() {

            var txt_pxqk_peixunxiangmu = $("#txt_pxqk_peixunxiangmu").val();
            var txt_pxqk_riqi = $("#txt_pxqk_riqi").val();
            var ddl_pxqk_leibie = $("#ddl_pxqk_leibie").val();

            $.ajax({
                type: "Post",
                url: "PeiXunYingJi.aspx/PeiXunQingKuang_Add",
                data: "{'txt_pxqk_peixunxiangmu':'" + txt_pxqk_peixunxiangmu + "','txt_pxqk_riqi':'" + txt_pxqk_riqi + "','ddl_pxqk_leibie':'" + ddl_pxqk_leibie + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "ok") {
                        alert("保存成功！");
                        window.location.href = 'PeiXunYingJi.aspx';
                    }
                }
            });
        }
        //获取数据
        function btn_pxqk_Get(cid) {
            $("#HidID").val(cid);

            $.ajax({
                type: "Post",
                url: "PeiXunYingJi.aspx/PeiXunQingKuang_Get",
                data: "{'_id':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#ddl_pxqk_leibie").val(data.d[0] == null ? "" : data.d[0]);
                    $("#txt_pxqk_peixunxiangmu").val(data.d[1] == null ? "" : data.d[1]);
                    $("#txt_pxqk_riqi").val(data.d[2] == null ? "" : data.d[2]);
                    
                    $("#btn_pxqk_Edit").show();
                    $("#btn_pxqk_Add").hide();
                    divshow("pxqk_div", "bg");
                }
            });
        }
        //编辑数据
        function btn_pxqk_Edit() {
            var txt_pxqk_peixunxiangmu = $("#txt_pxqk_peixunxiangmu").val();
            var txt_pxqk_riqi = $("#txt_pxqk_riqi").val();
            var ddl_pxqk_leibie = $("#ddl_pxqk_leibie").val();
            var cid = $("#HidID").val();

            $.ajax({
                type: "Post",
                url: "PeiXunYingJi.aspx/PeiXunQingKuang_Edit",
                data: "{'_id':'" + cid + "','txt_pxqk_peixunxiangmu':'" + txt_pxqk_peixunxiangmu + "','txt_pxqk_riqi':'" + txt_pxqk_riqi + "','ddl_pxqk_leibie':'" + ddl_pxqk_leibie + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = 'PeiXunYingJi.aspx';
                    }
                }
            });
        }
    </script>
</head>
<body>
    <input type="hidden" id="HidID" />
    <form runat="server">
        <table width="500" height="500">
            <tr>
                <td colspan="2">培训应急汇报：
                    <input type="radio" name="rbm" value="是" checked="checked"/>是
	                <input type="radio" name="rbm" value="否" />否
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table width="100%" id="table_yjqk">
                        <tr>
                            <td>
                                <table width="100%">
                                    <tr>
                                        <td align="left">应急情况</td>
                                        <td align="right">
                                            <input type="button" id="Button1" onclick="$('#btn_yjqk_Edit').hide(); divshow('yjqk_div', 'bg')" class="input_btn_a" value="新增" />
                                        </td>
                                        <td align="right">
                                            <input type="button" id="Button2" onclick="" class="input_btn_a" value="应急计划" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <table width="100%" border="1" cellpadding="0" cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th>序号
                                            </th>
                                            <th>名称
                                            </th>
                                            <th>人数
                                            </th>
                                            <th>类别
                                            </th>
                                            <th>选择文档
                                            </th>
                                            <th>操作
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <asp:Repeater ID="rpt_yingjiqingkuang" runat="server" OnItemCommand="rpt_yingjiqingkuang_ItemCommand">
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <%#Eval("id")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("mingchen")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("renshu")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("leibie")%>
                                                    </td>
                                                    <td></td>
                                                    <td align="center">
                                                        <img alt="" src="../../Images/file.gif" onclick="btn_yjqk_Get('<%#Eval("id")%>')" style="cursor: pointer;" />
                                                        <asp:ImageButton ID="img_btn" runat="server" ImageUrl="../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                                            CommandArgument='<%#Eval("id")%>' CommandName="del" />
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table width="100%" id="table_pxqk">
                        <tr>
                            <td>
                                <table width="100%">
                                    <tr>
                                        <td>培训情况</td>
                                        <td align="right">
                                            <input type="button" id="Button3" onclick="$('#btn_pxqk_Edit').hide(); divshow('pxqk_div', 'bg')" class="input_btn_a" value="新增" /></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <table width="100%" border="1" cellpadding="0" cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th>序号
                                            </th>
                                            <th>培训项目
                                            </th>
                                            <th>日期
                                            </th>
                                            <th>类别
                                            </th>
                                            <th>培训文档
                                            </th>
                                            <th>操作
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <asp:Repeater ID="rpt_peixunqingkuang" runat="server" OnItemCommand="rpt_peixunqingkuang_ItemCommand">
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <%#Eval("id")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("peixunxiangmu")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("riqi","{0:yyyy-MM-dd}")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("leibie")%>
                                                    </td>
                                                    <td></td>
                                                    <td align="center">
                                                        <img alt="" src="../../Images/file.gif" onclick="btn_pxqk_Get('<%#Eval("id")%>')" style="cursor: pointer;" />
                                                        <asp:ImageButton ID="img_btn" runat="server" ImageUrl="../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                                            CommandArgument='<%#Eval("id")%>' CommandName="del" />
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
    <!--弹出层背景-->
    <div id="bg" class="bg">
    </div>
    <!--弹出层应急情况-->
    <div id="yjqk_div" class="center_div" style="width: 400px; height: 200px; padding: 0px; margin-top: -100px;">
        <div class="div_0207" style="width: 398px; height: 100%; margin: 0px;">
            <h1>
                <img alt="应急情况" src="../../Images/cp_h1_03.gif" />添加应急情况</h1>
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="65" height="40" align="right">名称：
                    </td>
                    <td width="110">
                        <input type="text" id="txt_yjqk_mingchen" class="input_bg" />
                    </td>
                </tr>
                <tr>
                    <td width="65" align="right">人数：
                    </td>
                    <td width="110">
                        <input type="text" id="txt_yjqk_renshu" class="input_bg" />
                    </td>
                </tr>
                <tr>
                    <td align="right">类别：
                    </td>
                    <td>
                        <select id="ddl_yjqk_leibie">
                            <option value="火灾">火灾</option>
                            <option value="防盗">防盗</option>
                            <option value="绿化虫害">绿化虫害</option>
                            <option value="突发疾病">突发疾病</option>
                            <option value="人身伤害">人身伤害</option>
                        </select>
                    </td>
                </tr>
            </table>
            <table width="100%">
                <tr>
                    <td height="30" align="right">
                        <input type="button" id="btn_yjqk_Add" onclick="btn_yjqk_Add()" class="input_btn_a" value="提交" />
                        <input type="button" id="btn_yjqk_Edit" onclick="btn_yjqk_Edit()" class="input_btn_a" value="提交" />
                    </td>
                    <td>
                        <input type="button" id="but_Close" onclick='divhidel("yjqk_div", "bg")' class="input_btn_a"
                            value="关闭" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!--弹出层应急情况   结束-->

    <!--弹出层培训情况-->
    <div id="pxqk_div" class="center_div" style="width: 400px; height: 200px; padding: 0px; margin-top: -100px;">
        <div class="div_0207" style="width: 398px; height: 100%; margin: 0px;">
            <h1>
                <img src="../../Images/cp_h1_03.gif" />添加培训情况</h1>
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="65" height="40" align="right">培训项目：
                    </td>
                    <td width="110">
                        <input type="text" class="input_bg" id="txt_pxqk_peixunxiangmu" />
                    </td>
                </tr>
                <tr>
                    <td width="65" align="right">日期：
                    </td>
                    <td width="110">
                        <input type="text" class="input_bg" id="txt_pxqk_riqi" />
                    </td>
                </tr>
                <tr>
                    <td align="right">类别：
                    </td>
                    <td>
                        <select id="ddl_pxqk_leibie">
                            <option value="一级培训">一级培训</option>
                            <option value="二级培训">二级培训</option>
                        </select>
                    </td>
                </tr>
            </table>
            <table width="100%">
                <tr>
                    <td height="30" align="right">
                        <input type="button" id="btn_pxqk_Add" onclick="btn_pxqk_Add()" class="input_btn_a" value="提交" />
                        <input type="button" id="btn_pxqk_Edit" onclick="btn_pxqk_Edit()" class="input_btn_a" value="提交" />
                    </td>
                    <td>
                        <input type="button" id="Button6" onclick='divhidel("pxqk_div", "bg")' class="input_btn_a"
                            value="关闭" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!--弹出层培训情况   结束-->
</body>
</html>
